<?php

class m_settings extends CI_Model
{
    var $WEB_NAME = '';
    var $WEB_DESCRIPTION = '';
    var $WEB_LOGO = '';
    var $IS_MAINTENANCE = '';

    public function __construct()
    {
        parent::__construct();
    }

    public function select()
    {
        $this->db->select("settings.*");
    }

    public function get($where = null, $limit = null, $offset = null)
    {
        $this->select();
        if($where != null) $this->db->where($where);
        if($limit != null && $offset != null) $this->db->limit($limit, $offset);
        return $this->db->get("settings");
    }

    function truncate()
    {
        $this->db->truncate('settings');
    }

    public function update()
    {
        $this->WEB_NAME = $this->input->post('WEB_NAME');
        $this->WEB_DESCRIPTION = $this->input->post('WEB_DESCRIPTION');
        if(!$this->input->post('IS_MAINTENANCE'))
            $this->IS_MAINTENANCE = 0;
        else
            $this->IS_MAINTENANCE = 1;
        $this->WEB_LOGO = $this->input->post('WEB_LOGO');

        $this->db->update('settings', $this);
    }
}
?>